package com.caltco.cargo.ops.modules.sys.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

@Data
@TableName("task")
@Schema(description = "任务")
public class Task {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.ASSIGN_ID)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @Schema(description = "任务Id")
    private Long id;


    @Schema(description = "用户id")
    @TableField("user_id")
    @JsonProperty("userId")
    private Long userId;

    @Schema(description = "项目id")
    @TableField("project_id")
    @JsonProperty("projectId")
    private Long projectId;

    @Schema(description = "项目名称")
    @TableField("task_name")
    @JsonProperty("taskName")
    private String taskName;

    @Schema(description = "任务结束时间")
    @TableField("task_end_time")
    @JsonProperty("taskEndTime")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime taskEndTime;


    @Schema(description = "任务开始时间")
    @TableField("task_start_time")
    @JsonProperty("taskStartTime")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime taskStartTime;


    @Schema(description = "任务进度")
    @TableField("process")
    @JsonProperty("process")
    private Double process;

    @Schema(description = "任务描述")
    @TableField("task_description")
    @JsonProperty("taskDescription")
    private String taskDescription;

    @Schema(description = "是否立即发布")
    @TableField("is_publish")
    @JsonProperty("isPublish")
    private Integer isPublish;

    @Schema(description = "优先级")
    @TableField("level")
    @JsonProperty("level")
    private Integer level;

    @Schema(description = "项目负责人id")
    @TableField("handler_id")
    @JsonProperty("handlerId")
    private Long handlerId;

    @Schema(description = "是否删除")
    @TableField("is_delete")
    @JsonProperty("isDelete")
    @TableLogic(value = "0", delval = "1")
    private Integer isDelete;
}
